home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-14 | 2.0 KB | 81 lines | [TEXT/MPS ] |
- /*
- File: som_SamplePartInit.cpp
-
- Contains: CFM Library init routines for SamplePart
-
- Written by: Steve Smith
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
-
- */
-
-
- // -- Compiler/Preprocessor Switches --
-
- #ifndef _COMPILERDEFS_
- #include "CompDefs.h"
- #endif
-
- // -- OpenDoc Utilities --
-
- #ifndef _EXCEPT_
- // Exceptions define several important macros (ie. CHECKENV)
- // which are used in the SOM method dispatch glue. If Except.h
- // is not included early enough, exceptions may not be thrown
- // correctly when returning from a SOM method with "ev" parameter set.
- #include <Except.h>
- #endif
-
- #ifndef _USERSRCM_
- #include <UseRsrcM.h>
- #endif
-
- #ifndef _ODMEMORY_
- #include <ODMemory.h>
- #endif
-
- // -- MacToolbox Includes --
-
- #ifndef __CODEFRAGMENTS__
- #include <CodeFragments.h>
- #endif
-
- #pragma segment somSamplePartInit
-
- //------------------------------------------------------------------------------
- // Prototypes
- //------------------------------------------------------------------------------
-
- extern "C" pascal OSErr SamplePartCFMInit(CFragInitBlockPtr initBlkPtr);
- extern "C" pascal void SamplePartCFMTerminate();
-
- //------------------------------------------------------------------------------
- // Functions
- //------------------------------------------------------------------------------
-
- extern "C" pascal OSErr SamplePartCFMInit(CFragInitBlockPtr initBlkPtr)
- {
- // We are using OpenDoc's memory mgmt calls, so we must
- // initialize the interface to the memory manager.
- OSErr err1 = InitODMemory();
- // We must also capture the relevant information about
- // our library file so that we may access our resources.
- OSErr err2 = InitLibraryResources(initBlkPtr);
-
- #if ODDebug
- // DEBUG - drop into debugger if button down when lib loaded.
- if ( Button() ) DebugStr("\p");
- #endif
-
- return (OSErr) (err1 != noErr) ? err1 : err2;
- }
-
- extern "C" pascal void SamplePartCFMTerminate()
- {
- // The library is being unloaded from memory, so close our
- // resource fork.
- CloseLibraryResources();
- }
-
-
-